/**
 * 给定若干个数，分成完全相同的两个数组。
 */
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;

template <typename T>
const T & mymax(const T & a, const T & b){
    return max(a, b);
}

template<typename T, typename ... Args>
const T & mymax(const T & t, const Args & ... args){
    return max(t, mymax(args ...));
}

template<typename T>
void input(vector<T> & v, int n){
	v.assign(n + 1, {});
    for(int i=1;i<=n;++i) cin >> v[i];
	return;
}

template<typename T>
istream & operator >> (istream & is, vector<T> & v){
	for(auto & i : v) is >> i;
	return is;
}

using llt = long long;
using vi = vector<int>;
using vll = vector<llt>;

int N;

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(0);   
    cin >> N;
    map<int, int> cnt;
    for(int a,i=0;i<N+N;++i){
        cin >> a; cnt[a] += 1;
    }

    vi a, b;
    a.reserve(N); b.reserve(N);
    for(const auto & p : cnt){
        if(p.second & 1){
            cout << "-1\n"; return 0;
        }
        for(int i=0;i<p.second/2;++i){
            a.emplace_back(p.first);
            b.emplace_back(p.first);
        }
    }
    for(auto i : a) cout << i << " ";
    cout << endl;
    for(auto i : b) cout << i << " ";
    cout << endl;
    return 0;
}